<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.13"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>cpp_redis: includes/cpp_redis/core/subscriber.hpp Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><img alt="Logo" src="cpp_redis_logo.jpg"/></td>
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">cpp_redis
   &#160;<span id="projectnumber">4.0.0</span>
   </div>
   <div id="projectbrief">cpp_redis is a C++11 Asynchronous Multi-Platform Lightweight Redis Client, with support for synchronous operations and pipelining.</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.13 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="dir_09e761304027c904456130627fd4dcf5.html">includes</a></li><li class="navelem"><a class="el" href="dir_aabee9b2b90be9a3c8dcec590ad04d13.html">cpp_redis</a></li><li class="navelem"><a class="el" href="dir_4cd0548f4edb17fdac03175eefab51fa.html">core</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="headertitle">
<div class="title">subscriber.hpp</div>  </div>
</div><!--header-->
<div class="contents">
<div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160;<span class="comment">// The MIT License (MIT)</span></div><div class="line"><a name="l00002"></a><span class="lineno">    2</span>&#160;<span class="comment">//</span></div><div class="line"><a name="l00003"></a><span class="lineno">    3</span>&#160;<span class="comment">// Copyright (c) 2015-2017 Simon Ninon &lt;simon.ninon@gmail.com&gt;</span></div><div class="line"><a name="l00004"></a><span class="lineno">    4</span>&#160;<span class="comment">//</span></div><div class="line"><a name="l00005"></a><span class="lineno">    5</span>&#160;<span class="comment">// Permission is hereby granted, free of charge, to any person obtaining a copy</span></div><div class="line"><a name="l00006"></a><span class="lineno">    6</span>&#160;<span class="comment">// of this software and associated documentation files (the &quot;Software&quot;), to deal</span></div><div class="line"><a name="l00007"></a><span class="lineno">    7</span>&#160;<span class="comment">// in the Software without restriction, including without limitation the rights</span></div><div class="line"><a name="l00008"></a><span class="lineno">    8</span>&#160;<span class="comment">// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell</span></div><div class="line"><a name="l00009"></a><span class="lineno">    9</span>&#160;<span class="comment">// copies of the Software, and to permit persons to whom the Software is</span></div><div class="line"><a name="l00010"></a><span class="lineno">   10</span>&#160;<span class="comment">// furnished to do so, subject to the following conditions:</span></div><div class="line"><a name="l00011"></a><span class="lineno">   11</span>&#160;<span class="comment">//</span></div><div class="line"><a name="l00012"></a><span class="lineno">   12</span>&#160;<span class="comment">// The above copyright notice and this permission notice shall be included in all</span></div><div class="line"><a name="l00013"></a><span class="lineno">   13</span>&#160;<span class="comment">// copies or substantial portions of the Software.</span></div><div class="line"><a name="l00014"></a><span class="lineno">   14</span>&#160;<span class="comment">//</span></div><div class="line"><a name="l00015"></a><span class="lineno">   15</span>&#160;<span class="comment">// THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR</span></div><div class="line"><a name="l00016"></a><span class="lineno">   16</span>&#160;<span class="comment">// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,</span></div><div class="line"><a name="l00017"></a><span class="lineno">   17</span>&#160;<span class="comment">// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE</span></div><div class="line"><a name="l00018"></a><span class="lineno">   18</span>&#160;<span class="comment">// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER</span></div><div class="line"><a name="l00019"></a><span class="lineno">   19</span>&#160;<span class="comment">// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,</span></div><div class="line"><a name="l00020"></a><span class="lineno">   20</span>&#160;<span class="comment">// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE</span></div><div class="line"><a name="l00021"></a><span class="lineno">   21</span>&#160;<span class="comment">// SOFTWARE.</span></div><div class="line"><a name="l00022"></a><span class="lineno">   22</span>&#160;</div><div class="line"><a name="l00023"></a><span class="lineno">   23</span>&#160;<span class="preprocessor">#pragma once</span></div><div class="line"><a name="l00024"></a><span class="lineno">   24</span>&#160;</div><div class="line"><a name="l00025"></a><span class="lineno">   25</span>&#160;<span class="preprocessor">#include &lt;atomic&gt;</span></div><div class="line"><a name="l00026"></a><span class="lineno">   26</span>&#160;<span class="preprocessor">#include &lt;functional&gt;</span></div><div class="line"><a name="l00027"></a><span class="lineno">   27</span>&#160;<span class="preprocessor">#include &lt;map&gt;</span></div><div class="line"><a name="l00028"></a><span class="lineno">   28</span>&#160;<span class="preprocessor">#include &lt;mutex&gt;</span></div><div class="line"><a name="l00029"></a><span class="lineno">   29</span>&#160;<span class="preprocessor">#include &lt;string&gt;</span></div><div class="line"><a name="l00030"></a><span class="lineno">   30</span>&#160;</div><div class="line"><a name="l00031"></a><span class="lineno">   31</span>&#160;<span class="preprocessor">#include &lt;cpp_redis/core/sentinel.hpp&gt;</span></div><div class="line"><a name="l00032"></a><span class="lineno">   32</span>&#160;<span class="preprocessor">#include &lt;cpp_redis/network/redis_connection.hpp&gt;</span></div><div class="line"><a name="l00033"></a><span class="lineno">   33</span>&#160;<span class="preprocessor">#include &lt;cpp_redis/network/tcp_client_iface.hpp&gt;</span></div><div class="line"><a name="l00034"></a><span class="lineno">   34</span>&#160;</div><div class="line"><a name="l00035"></a><span class="lineno">   35</span>&#160;<span class="keyword">namespace </span><a class="code" href="namespacecpp__redis.html">cpp_redis</a> {</div><div class="line"><a name="l00036"></a><span class="lineno">   36</span>&#160;</div><div class="line"><a name="l00043"></a><span class="lineno"><a class="line" href="classcpp__redis_1_1subscriber.html">   43</a></span>&#160;<span class="keyword">class </span><a class="code" href="classcpp__redis_1_1subscriber.html">subscriber</a> {</div><div class="line"><a name="l00044"></a><span class="lineno">   44</span>&#160;<span class="keyword">public</span>:</div><div class="line"><a name="l00045"></a><span class="lineno">   45</span>&#160;<span class="preprocessor">#ifndef __CPP_REDIS_USE_CUSTOM_TCP_CLIENT</span></div><div class="line"><a name="l00046"></a><span class="lineno">   46</span>&#160;  <a class="code" href="classcpp__redis_1_1subscriber.html#ab7feafca57399394e3a1a0d6daf52770">subscriber</a>(<span class="keywordtype">void</span>);</div><div class="line"><a name="l00048"></a><span class="lineno">   48</span>&#160;<span class="preprocessor">#endif </span><span class="comment">/* __CPP_REDIS_USE_CUSTOM_TCP_CLIENT */</span><span class="preprocessor"></span></div><div class="line"><a name="l00049"></a><span class="lineno">   49</span>&#160;</div><div class="line"><a name="l00055"></a><span class="lineno">   55</span>&#160;  <span class="keyword">explicit</span> <a class="code" href="classcpp__redis_1_1subscriber.html#ab7feafca57399394e3a1a0d6daf52770">subscriber</a>(<span class="keyword">const</span> std::shared_ptr&lt;network::tcp_client_iface&gt;&amp; tcp_client);</div><div class="line"><a name="l00056"></a><span class="lineno">   56</span>&#160;</div><div class="line"><a name="l00058"></a><span class="lineno">   58</span>&#160;  <a class="code" href="classcpp__redis_1_1subscriber.html#a878caeb144b11de30466a380b09abc30">~subscriber</a>(<span class="keywordtype">void</span>);</div><div class="line"><a name="l00059"></a><span class="lineno">   59</span>&#160;</div><div class="line"><a name="l00061"></a><span class="lineno">   61</span>&#160;  <a class="code" href="classcpp__redis_1_1subscriber.html#ab7feafca57399394e3a1a0d6daf52770">subscriber</a>(<span class="keyword">const</span> <a class="code" href="classcpp__redis_1_1subscriber.html">subscriber</a>&amp;) = <span class="keyword">delete</span>;</div><div class="line"><a name="l00063"></a><span class="lineno">   63</span>&#160;  <a class="code" href="classcpp__redis_1_1subscriber.html">subscriber</a>&amp; <a class="code" href="classcpp__redis_1_1subscriber.html#ac60f83e6e915073bda6853baaeb39485">operator=</a>(<span class="keyword">const</span> <a class="code" href="classcpp__redis_1_1subscriber.html">subscriber</a>&amp;) = <span class="keyword">delete</span>;</div><div class="line"><a name="l00064"></a><span class="lineno">   64</span>&#160;</div><div class="line"><a name="l00065"></a><span class="lineno">   65</span>&#160;<span class="keyword">public</span>:</div><div class="line"><a name="l00076"></a><span class="lineno"><a class="line" href="classcpp__redis_1_1subscriber.html#afc976757efd9d0ac4def6935546a2338">   76</a></span>&#160;  <span class="keyword">enum class</span> <a class="code" href="classcpp__redis_1_1subscriber.html#afc976757efd9d0ac4def6935546a2338">connect_state</a> {</div><div class="line"><a name="l00077"></a><span class="lineno">   77</span>&#160;    dropped,</div><div class="line"><a name="l00078"></a><span class="lineno">   78</span>&#160;    start,</div><div class="line"><a name="l00079"></a><span class="lineno">   79</span>&#160;    sleeping,</div><div class="line"><a name="l00080"></a><span class="lineno">   80</span>&#160;    ok,</div><div class="line"><a name="l00081"></a><span class="lineno">   81</span>&#160;    failed,</div><div class="line"><a name="l00082"></a><span class="lineno">   82</span>&#160;    lookup_failed,</div><div class="line"><a name="l00083"></a><span class="lineno">   83</span>&#160;    stopped</div><div class="line"><a name="l00084"></a><span class="lineno">   84</span>&#160;  };</div><div class="line"><a name="l00085"></a><span class="lineno">   85</span>&#160;</div><div class="line"><a name="l00086"></a><span class="lineno">   86</span>&#160;<span class="keyword">public</span>:</div><div class="line"><a name="l00090"></a><span class="lineno"><a class="line" href="classcpp__redis_1_1subscriber.html#a90f2f7d4c748c3c2e89d1e977fa6dce1">   90</a></span>&#160;  <span class="keyword">typedef</span> std::function&lt;void(const std::string&amp; host, std::size_t port, connect_state status)&gt; <a class="code" href="classcpp__redis_1_1subscriber.html#a90f2f7d4c748c3c2e89d1e977fa6dce1">connect_callback_t</a>;</div><div class="line"><a name="l00091"></a><span class="lineno">   91</span>&#160;</div><div class="line"><a name="l00102"></a><span class="lineno">  102</span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classcpp__redis_1_1subscriber.html#a6ae8134a9a9b31d6f2434ec4f6e86d3a">connect</a>(</div><div class="line"><a name="l00103"></a><span class="lineno">  103</span>&#160;    <span class="keyword">const</span> std::string&amp; host                    = <span class="stringliteral">&quot;127.0.0.1&quot;</span>,</div><div class="line"><a name="l00104"></a><span class="lineno">  104</span>&#160;    std::size_t port                           = 6379,</div><div class="line"><a name="l00105"></a><span class="lineno">  105</span>&#160;    <span class="keyword">const</span> connect_callback_t&amp; connect_callback = <span class="keyword">nullptr</span>,</div><div class="line"><a name="l00106"></a><span class="lineno">  106</span>&#160;    std::uint32_t timeout_msecs                = 0,</div><div class="line"><a name="l00107"></a><span class="lineno">  107</span>&#160;    std::int32_t max_reconnects                = 0,</div><div class="line"><a name="l00108"></a><span class="lineno">  108</span>&#160;    std::uint32_t reconnect_interval_msecs     = 0);</div><div class="line"><a name="l00109"></a><span class="lineno">  109</span>&#160;</div><div class="line"><a name="l00119"></a><span class="lineno">  119</span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classcpp__redis_1_1subscriber.html#a6ae8134a9a9b31d6f2434ec4f6e86d3a">connect</a>(</div><div class="line"><a name="l00120"></a><span class="lineno">  120</span>&#160;    <span class="keyword">const</span> std::string&amp; name,</div><div class="line"><a name="l00121"></a><span class="lineno">  121</span>&#160;    <span class="keyword">const</span> connect_callback_t&amp; connect_callback = <span class="keyword">nullptr</span>,</div><div class="line"><a name="l00122"></a><span class="lineno">  122</span>&#160;    std::uint32_t timeout_msecs                = 0,</div><div class="line"><a name="l00123"></a><span class="lineno">  123</span>&#160;    std::int32_t max_reconnects                = 0,</div><div class="line"><a name="l00124"></a><span class="lineno">  124</span>&#160;    std::uint32_t reconnect_interval_msecs     = 0);</div><div class="line"><a name="l00125"></a><span class="lineno">  125</span>&#160;</div><div class="line"><a name="l00129"></a><span class="lineno">  129</span>&#160;  <span class="keywordtype">bool</span> <a class="code" href="classcpp__redis_1_1subscriber.html#a13ff83c3944b33851dfcf364f53b146c">is_connected</a>(<span class="keywordtype">void</span>) <span class="keyword">const</span>;</div><div class="line"><a name="l00130"></a><span class="lineno">  130</span>&#160;</div><div class="line"><a name="l00136"></a><span class="lineno">  136</span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classcpp__redis_1_1subscriber.html#aad1d0c3c6edb1522eb7b1bdb64b4705d">disconnect</a>(<span class="keywordtype">bool</span> wait_for_removal = <span class="keyword">false</span>);</div><div class="line"><a name="l00137"></a><span class="lineno">  137</span>&#160;</div><div class="line"><a name="l00141"></a><span class="lineno">  141</span>&#160;  <span class="keywordtype">bool</span> <a class="code" href="classcpp__redis_1_1subscriber.html#a32eb4feb4858c972ebb9887d21cb62d7">is_reconnecting</a>(<span class="keywordtype">void</span>) <span class="keyword">const</span>;</div><div class="line"><a name="l00142"></a><span class="lineno">  142</span>&#160;</div><div class="line"><a name="l00146"></a><span class="lineno">  146</span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classcpp__redis_1_1subscriber.html#a6d5bdcf7c5a67d1b56b021bbd450a7c3">cancel_reconnect</a>(<span class="keywordtype">void</span>);</div><div class="line"><a name="l00147"></a><span class="lineno">  147</span>&#160;</div><div class="line"><a name="l00148"></a><span class="lineno">  148</span>&#160;<span class="keyword">public</span>:</div><div class="line"><a name="l00153"></a><span class="lineno"><a class="line" href="classcpp__redis_1_1subscriber.html#a99d220cc662664e2399b709f61ac9581">  153</a></span>&#160;  <span class="keyword">typedef</span> std::function&lt;void(reply&amp;)&gt; <a class="code" href="classcpp__redis_1_1subscriber.html#a99d220cc662664e2399b709f61ac9581">reply_callback_t</a>;</div><div class="line"><a name="l00154"></a><span class="lineno">  154</span>&#160;</div><div class="line"><a name="l00164"></a><span class="lineno">  164</span>&#160;  <a class="code" href="classcpp__redis_1_1subscriber.html">subscriber</a>&amp; <a class="code" href="classcpp__redis_1_1subscriber.html#a7b4564fc4dfe356b95aeae4fdb8071c9">auth</a>(<span class="keyword">const</span> std::string&amp; password, <span class="keyword">const</span> reply_callback_t&amp; reply_callback = <span class="keyword">nullptr</span>);</div><div class="line"><a name="l00165"></a><span class="lineno">  165</span>&#160;</div><div class="line"><a name="l00170"></a><span class="lineno"><a class="line" href="classcpp__redis_1_1subscriber.html#ac6ab8ebc526d784e4b79a39bbd73dca8">  170</a></span>&#160;  <span class="keyword">typedef</span> std::function&lt;void(const std::string&amp;, const std::string&amp;)&gt; <a class="code" href="classcpp__redis_1_1subscriber.html#ac6ab8ebc526d784e4b79a39bbd73dca8">subscribe_callback_t</a>;</div><div class="line"><a name="l00171"></a><span class="lineno">  171</span>&#160;</div><div class="line"><a name="l00176"></a><span class="lineno"><a class="line" href="classcpp__redis_1_1subscriber.html#a19ea39dfabeb19937a9ce4c8d21781b4">  176</a></span>&#160;  <span class="keyword">typedef</span> std::function&lt;void(int64_t)&gt; <a class="code" href="classcpp__redis_1_1subscriber.html#a19ea39dfabeb19937a9ce4c8d21781b4">acknowledgement_callback_t</a>;</div><div class="line"><a name="l00177"></a><span class="lineno">  177</span>&#160;</div><div class="line"><a name="l00189"></a><span class="lineno">  189</span>&#160;  <a class="code" href="classcpp__redis_1_1subscriber.html">subscriber</a>&amp; <a class="code" href="classcpp__redis_1_1subscriber.html#afee579c702182041645a3d3c55de4b9e">subscribe</a>(<span class="keyword">const</span> std::string&amp; channel, <span class="keyword">const</span> subscribe_callback_t&amp; callback, <span class="keyword">const</span> acknowledgement_callback_t&amp; acknowledgement_callback = <span class="keyword">nullptr</span>);</div><div class="line"><a name="l00190"></a><span class="lineno">  190</span>&#160;</div><div class="line"><a name="l00202"></a><span class="lineno">  202</span>&#160;  <a class="code" href="classcpp__redis_1_1subscriber.html">subscriber</a>&amp; <a class="code" href="classcpp__redis_1_1subscriber.html#a52605edb2a85d370680c3c9e1b84fc3b">psubscribe</a>(<span class="keyword">const</span> std::string&amp; pattern, <span class="keyword">const</span> subscribe_callback_t&amp; callback, <span class="keyword">const</span> acknowledgement_callback_t&amp; acknowledgement_callback = <span class="keyword">nullptr</span>);</div><div class="line"><a name="l00203"></a><span class="lineno">  203</span>&#160;</div><div class="line"><a name="l00211"></a><span class="lineno">  211</span>&#160;  <a class="code" href="classcpp__redis_1_1subscriber.html">subscriber</a>&amp; <a class="code" href="classcpp__redis_1_1subscriber.html#a08dffea41cfd5914adfa5a966e0ab292">unsubscribe</a>(<span class="keyword">const</span> std::string&amp; channel);</div><div class="line"><a name="l00212"></a><span class="lineno">  212</span>&#160;</div><div class="line"><a name="l00220"></a><span class="lineno">  220</span>&#160;  <a class="code" href="classcpp__redis_1_1subscriber.html">subscriber</a>&amp; <a class="code" href="classcpp__redis_1_1subscriber.html#a26edc7dcf87ddc8734fac04878ca307a">punsubscribe</a>(<span class="keyword">const</span> std::string&amp; pattern);</div><div class="line"><a name="l00221"></a><span class="lineno">  221</span>&#160;</div><div class="line"><a name="l00228"></a><span class="lineno">  228</span>&#160;  <a class="code" href="classcpp__redis_1_1subscriber.html">subscriber</a>&amp; <a class="code" href="classcpp__redis_1_1subscriber.html#abbf600802ed93b82323185eec5719ecb">commit</a>(<span class="keywordtype">void</span>);</div><div class="line"><a name="l00229"></a><span class="lineno">  229</span>&#160;</div><div class="line"><a name="l00230"></a><span class="lineno">  230</span>&#160;<span class="keyword">public</span>:</div><div class="line"><a name="l00238"></a><span class="lineno">  238</span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classcpp__redis_1_1subscriber.html#a2faf9e9cc9c95e3c0fed148355af84f1">add_sentinel</a>(<span class="keyword">const</span> std::string&amp; host, std::size_t port, std::uint32_t timeout_msecs = 0);</div><div class="line"><a name="l00239"></a><span class="lineno">  239</span>&#160;</div><div class="line"><a name="l00245"></a><span class="lineno">  245</span>&#160;  <span class="keyword">const</span> <a class="code" href="classcpp__redis_1_1sentinel.html">sentinel</a>&amp; <a class="code" href="classcpp__redis_1_1subscriber.html#a55a8906106adceca1faf6ab26e040f8a">get_sentinel</a>(<span class="keywordtype">void</span>) <span class="keyword">const</span>;</div><div class="line"><a name="l00246"></a><span class="lineno">  246</span>&#160;</div><div class="line"><a name="l00253"></a><span class="lineno">  253</span>&#160;  <a class="code" href="classcpp__redis_1_1sentinel.html">sentinel</a>&amp; <a class="code" href="classcpp__redis_1_1subscriber.html#a55a8906106adceca1faf6ab26e040f8a">get_sentinel</a>(<span class="keywordtype">void</span>);</div><div class="line"><a name="l00254"></a><span class="lineno">  254</span>&#160;</div><div class="line"><a name="l00258"></a><span class="lineno">  258</span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classcpp__redis_1_1subscriber.html#ac8f371c14866842cdda7cf1ee5eee2b8">clear_sentinels</a>(<span class="keywordtype">void</span>);</div><div class="line"><a name="l00259"></a><span class="lineno">  259</span>&#160;</div><div class="line"><a name="l00260"></a><span class="lineno">  260</span>&#160;<span class="keyword">private</span>:</div><div class="line"><a name="l00264"></a><span class="lineno">  264</span>&#160;  <span class="keyword">struct </span>callback_holder {</div><div class="line"><a name="l00265"></a><span class="lineno">  265</span>&#160;    subscribe_callback_t subscribe_callback;</div><div class="line"><a name="l00266"></a><span class="lineno">  266</span>&#160;    acknowledgement_callback_t acknowledgement_callback;</div><div class="line"><a name="l00267"></a><span class="lineno">  267</span>&#160;  };</div><div class="line"><a name="l00268"></a><span class="lineno">  268</span>&#160;</div><div class="line"><a name="l00269"></a><span class="lineno">  269</span>&#160;<span class="keyword">private</span>:</div><div class="line"><a name="l00276"></a><span class="lineno">  276</span>&#160;  <span class="keywordtype">void</span> connection_receive_handler(<a class="code" href="classcpp__redis_1_1network_1_1redis__connection.html">network::redis_connection</a>&amp; connection, <a class="code" href="classcpp__redis_1_1reply.html">reply</a>&amp; <a class="code" href="classcpp__redis_1_1reply.html">reply</a>);</div><div class="line"><a name="l00277"></a><span class="lineno">  277</span>&#160;</div><div class="line"><a name="l00283"></a><span class="lineno">  283</span>&#160;  <span class="keywordtype">void</span> connection_disconnection_handler(<a class="code" href="classcpp__redis_1_1network_1_1redis__connection.html">network::redis_connection</a>&amp; connection);</div><div class="line"><a name="l00284"></a><span class="lineno">  284</span>&#160;</div><div class="line"><a name="l00291"></a><span class="lineno">  291</span>&#160;  <span class="keywordtype">void</span> handle_acknowledgement_reply(<span class="keyword">const</span> std::vector&lt;reply&gt;&amp; <a class="code" href="classcpp__redis_1_1reply.html">reply</a>);</div><div class="line"><a name="l00292"></a><span class="lineno">  292</span>&#160;</div><div class="line"><a name="l00299"></a><span class="lineno">  299</span>&#160;  <span class="keywordtype">void</span> handle_subscribe_reply(<span class="keyword">const</span> std::vector&lt;reply&gt;&amp; <a class="code" href="classcpp__redis_1_1reply.html">reply</a>);</div><div class="line"><a name="l00300"></a><span class="lineno">  300</span>&#160;</div><div class="line"><a name="l00307"></a><span class="lineno">  307</span>&#160;  <span class="keywordtype">void</span> handle_psubscribe_reply(<span class="keyword">const</span> std::vector&lt;reply&gt;&amp; <a class="code" href="classcpp__redis_1_1reply.html">reply</a>);</div><div class="line"><a name="l00308"></a><span class="lineno">  308</span>&#160;</div><div class="line"><a name="l00317"></a><span class="lineno">  317</span>&#160;  <span class="keywordtype">void</span> call_acknowledgement_callback(<span class="keyword">const</span> std::string&amp; channel, <span class="keyword">const</span> std::map&lt;std::string, callback_holder&gt;&amp; channels, std::mutex&amp; channels_mtx, int64_t nb_chans);</div><div class="line"><a name="l00318"></a><span class="lineno">  318</span>&#160;</div><div class="line"><a name="l00319"></a><span class="lineno">  319</span>&#160;<span class="keyword">private</span>:</div><div class="line"><a name="l00324"></a><span class="lineno">  324</span>&#160;  <span class="keywordtype">void</span> reconnect(<span class="keywordtype">void</span>);</div><div class="line"><a name="l00325"></a><span class="lineno">  325</span>&#160;</div><div class="line"><a name="l00329"></a><span class="lineno">  329</span>&#160;  <span class="keywordtype">void</span> re_auth(<span class="keywordtype">void</span>);</div><div class="line"><a name="l00330"></a><span class="lineno">  330</span>&#160;</div><div class="line"><a name="l00334"></a><span class="lineno">  334</span>&#160;  <span class="keywordtype">void</span> re_subscribe(<span class="keywordtype">void</span>);</div><div class="line"><a name="l00335"></a><span class="lineno">  335</span>&#160;</div><div class="line"><a name="l00339"></a><span class="lineno">  339</span>&#160;  <span class="keywordtype">bool</span> should_reconnect(<span class="keywordtype">void</span>) <span class="keyword">const</span>;</div><div class="line"><a name="l00340"></a><span class="lineno">  340</span>&#160;</div><div class="line"><a name="l00344"></a><span class="lineno">  344</span>&#160;  <span class="keywordtype">void</span> sleep_before_next_reconnect_attempt(<span class="keywordtype">void</span>);</div><div class="line"><a name="l00345"></a><span class="lineno">  345</span>&#160;</div><div class="line"><a name="l00349"></a><span class="lineno">  349</span>&#160;  <span class="keywordtype">void</span> clear_subscriptions(<span class="keywordtype">void</span>);</div><div class="line"><a name="l00350"></a><span class="lineno">  350</span>&#160;</div><div class="line"><a name="l00351"></a><span class="lineno">  351</span>&#160;<span class="keyword">private</span>:</div><div class="line"><a name="l00360"></a><span class="lineno">  360</span>&#160;  <span class="keywordtype">void</span> unprotected_subscribe(<span class="keyword">const</span> std::string&amp; channel, <span class="keyword">const</span> subscribe_callback_t&amp; callback, <span class="keyword">const</span> acknowledgement_callback_t&amp; acknowledgement_callback);</div><div class="line"><a name="l00361"></a><span class="lineno">  361</span>&#160;</div><div class="line"><a name="l00370"></a><span class="lineno">  370</span>&#160;  <span class="keywordtype">void</span> unprotected_psubscribe(<span class="keyword">const</span> std::string&amp; pattern, <span class="keyword">const</span> subscribe_callback_t&amp; callback, <span class="keyword">const</span> acknowledgement_callback_t&amp; acknowledgement_callback);</div><div class="line"><a name="l00371"></a><span class="lineno">  371</span>&#160;</div><div class="line"><a name="l00372"></a><span class="lineno">  372</span>&#160;<span class="keyword">private</span>:</div><div class="line"><a name="l00376"></a><span class="lineno">  376</span>&#160;  std::string m_redis_server;</div><div class="line"><a name="l00380"></a><span class="lineno">  380</span>&#160;  std::size_t m_redis_port = 0;</div><div class="line"><a name="l00384"></a><span class="lineno">  384</span>&#160;  std::string m_master_name;</div><div class="line"><a name="l00388"></a><span class="lineno">  388</span>&#160;  std::string m_password;</div><div class="line"><a name="l00389"></a><span class="lineno">  389</span>&#160;</div><div class="line"><a name="l00393"></a><span class="lineno">  393</span>&#160;  <a class="code" href="classcpp__redis_1_1network_1_1redis__connection.html">network::redis_connection</a> m_client;</div><div class="line"><a name="l00394"></a><span class="lineno">  394</span>&#160;</div><div class="line"><a name="l00398"></a><span class="lineno">  398</span>&#160;  <a class="code" href="classcpp__redis_1_1sentinel.html">cpp_redis::sentinel</a> m_sentinel;</div><div class="line"><a name="l00399"></a><span class="lineno">  399</span>&#160;</div><div class="line"><a name="l00403"></a><span class="lineno">  403</span>&#160;  std::uint32_t m_connect_timeout_msecs = 0;</div><div class="line"><a name="l00407"></a><span class="lineno">  407</span>&#160;  std::int32_t m_max_reconnects = 0;</div><div class="line"><a name="l00411"></a><span class="lineno">  411</span>&#160;  std::int32_t m_current_reconnect_attempts = 0;</div><div class="line"><a name="l00415"></a><span class="lineno">  415</span>&#160;  std::uint32_t m_reconnect_interval_msecs = 0;</div><div class="line"><a name="l00416"></a><span class="lineno">  416</span>&#160;</div><div class="line"><a name="l00420"></a><span class="lineno">  420</span>&#160;  std::atomic_bool m_reconnecting;</div><div class="line"><a name="l00424"></a><span class="lineno">  424</span>&#160;  std::atomic_bool m_cancel;</div><div class="line"><a name="l00425"></a><span class="lineno">  425</span>&#160;</div><div class="line"><a name="l00429"></a><span class="lineno">  429</span>&#160;  std::map&lt;std::string, callback_holder&gt; m_subscribed_channels;</div><div class="line"><a name="l00433"></a><span class="lineno">  433</span>&#160;  std::map&lt;std::string, callback_holder&gt; m_psubscribed_channels;</div><div class="line"><a name="l00434"></a><span class="lineno">  434</span>&#160;</div><div class="line"><a name="l00438"></a><span class="lineno">  438</span>&#160;  connect_callback_t m_connect_callback;</div><div class="line"><a name="l00439"></a><span class="lineno">  439</span>&#160;</div><div class="line"><a name="l00443"></a><span class="lineno">  443</span>&#160;  std::mutex m_psubscribed_channels_mutex;</div><div class="line"><a name="l00447"></a><span class="lineno">  447</span>&#160;  std::mutex m_subscribed_channels_mutex;</div><div class="line"><a name="l00448"></a><span class="lineno">  448</span>&#160;</div><div class="line"><a name="l00452"></a><span class="lineno">  452</span>&#160;  reply_callback_t m_auth_reply_callback;</div><div class="line"><a name="l00453"></a><span class="lineno">  453</span>&#160;};</div><div class="line"><a name="l00454"></a><span class="lineno">  454</span>&#160;</div><div class="line"><a name="l00455"></a><span class="lineno">  455</span>&#160;} <span class="comment">// namespace cpp_redis</span></div><div class="ttc" id="classcpp__redis_1_1subscriber_html_ac8f371c14866842cdda7cf1ee5eee2b8"><div class="ttname"><a href="classcpp__redis_1_1subscriber.html#ac8f371c14866842cdda7cf1ee5eee2b8">cpp_redis::subscriber::clear_sentinels</a></div><div class="ttdeci">void clear_sentinels(void)</div></div>
<div class="ttc" id="classcpp__redis_1_1network_1_1redis__connection_html"><div class="ttname"><a href="classcpp__redis_1_1network_1_1redis__connection.html">cpp_redis::network::redis_connection</a></div><div class="ttdef"><b>Definition:</b> redis_connection.hpp:45</div></div>
<div class="ttc" id="classcpp__redis_1_1subscriber_html"><div class="ttname"><a href="classcpp__redis_1_1subscriber.html">cpp_redis::subscriber</a></div><div class="ttdef"><b>Definition:</b> subscriber.hpp:43</div></div>
<div class="ttc" id="classcpp__redis_1_1subscriber_html_a90f2f7d4c748c3c2e89d1e977fa6dce1"><div class="ttname"><a href="classcpp__redis_1_1subscriber.html#a90f2f7d4c748c3c2e89d1e977fa6dce1">cpp_redis::subscriber::connect_callback_t</a></div><div class="ttdeci">std::function&lt; void(const std::string &amp;host, std::size_t port, connect_state status)&gt; connect_callback_t</div><div class="ttdef"><b>Definition:</b> subscriber.hpp:90</div></div>
<div class="ttc" id="classcpp__redis_1_1subscriber_html_a878caeb144b11de30466a380b09abc30"><div class="ttname"><a href="classcpp__redis_1_1subscriber.html#a878caeb144b11de30466a380b09abc30">cpp_redis::subscriber::~subscriber</a></div><div class="ttdeci">~subscriber(void)</div><div class="ttdoc">dtor </div></div>
<div class="ttc" id="classcpp__redis_1_1subscriber_html_a52605edb2a85d370680c3c9e1b84fc3b"><div class="ttname"><a href="classcpp__redis_1_1subscriber.html#a52605edb2a85d370680c3c9e1b84fc3b">cpp_redis::subscriber::psubscribe</a></div><div class="ttdeci">subscriber &amp; psubscribe(const std::string &amp;pattern, const subscribe_callback_t &amp;callback, const acknowledgement_callback_t &amp;acknowledgement_callback=nullptr)</div></div>
<div class="ttc" id="classcpp__redis_1_1subscriber_html_abbf600802ed93b82323185eec5719ecb"><div class="ttname"><a href="classcpp__redis_1_1subscriber.html#abbf600802ed93b82323185eec5719ecb">cpp_redis::subscriber::commit</a></div><div class="ttdeci">subscriber &amp; commit(void)</div></div>
<div class="ttc" id="classcpp__redis_1_1reply_html"><div class="ttname"><a href="classcpp__redis_1_1reply.html">cpp_redis::reply</a></div><div class="ttdef"><b>Definition:</b> reply.hpp:37</div></div>
<div class="ttc" id="classcpp__redis_1_1subscriber_html_a99d220cc662664e2399b709f61ac9581"><div class="ttname"><a href="classcpp__redis_1_1subscriber.html#a99d220cc662664e2399b709f61ac9581">cpp_redis::subscriber::reply_callback_t</a></div><div class="ttdeci">std::function&lt; void(reply &amp;)&gt; reply_callback_t</div><div class="ttdef"><b>Definition:</b> subscriber.hpp:153</div></div>
<div class="ttc" id="classcpp__redis_1_1subscriber_html_ac60f83e6e915073bda6853baaeb39485"><div class="ttname"><a href="classcpp__redis_1_1subscriber.html#ac60f83e6e915073bda6853baaeb39485">cpp_redis::subscriber::operator=</a></div><div class="ttdeci">subscriber &amp; operator=(const subscriber &amp;)=delete</div><div class="ttdoc">assignment operator </div></div>
<div class="ttc" id="classcpp__redis_1_1subscriber_html_a32eb4feb4858c972ebb9887d21cb62d7"><div class="ttname"><a href="classcpp__redis_1_1subscriber.html#a32eb4feb4858c972ebb9887d21cb62d7">cpp_redis::subscriber::is_reconnecting</a></div><div class="ttdeci">bool is_reconnecting(void) const</div></div>
<div class="ttc" id="classcpp__redis_1_1subscriber_html_a19ea39dfabeb19937a9ce4c8d21781b4"><div class="ttname"><a href="classcpp__redis_1_1subscriber.html#a19ea39dfabeb19937a9ce4c8d21781b4">cpp_redis::subscriber::acknowledgement_callback_t</a></div><div class="ttdeci">std::function&lt; void(int64_t)&gt; acknowledgement_callback_t</div><div class="ttdef"><b>Definition:</b> subscriber.hpp:176</div></div>
<div class="ttc" id="classcpp__redis_1_1subscriber_html_afc976757efd9d0ac4def6935546a2338"><div class="ttname"><a href="classcpp__redis_1_1subscriber.html#afc976757efd9d0ac4def6935546a2338">cpp_redis::subscriber::connect_state</a></div><div class="ttdeci">connect_state</div><div class="ttdef"><b>Definition:</b> subscriber.hpp:76</div></div>
<div class="ttc" id="classcpp__redis_1_1subscriber_html_a6d5bdcf7c5a67d1b56b021bbd450a7c3"><div class="ttname"><a href="classcpp__redis_1_1subscriber.html#a6d5bdcf7c5a67d1b56b021bbd450a7c3">cpp_redis::subscriber::cancel_reconnect</a></div><div class="ttdeci">void cancel_reconnect(void)</div></div>
<div class="ttc" id="classcpp__redis_1_1subscriber_html_a7b4564fc4dfe356b95aeae4fdb8071c9"><div class="ttname"><a href="classcpp__redis_1_1subscriber.html#a7b4564fc4dfe356b95aeae4fdb8071c9">cpp_redis::subscriber::auth</a></div><div class="ttdeci">subscriber &amp; auth(const std::string &amp;password, const reply_callback_t &amp;reply_callback=nullptr)</div></div>
<div class="ttc" id="classcpp__redis_1_1sentinel_html"><div class="ttname"><a href="classcpp__redis_1_1sentinel.html">cpp_redis::sentinel</a></div><div class="ttdef"><b>Definition:</b> sentinel.hpp:40</div></div>
<div class="ttc" id="classcpp__redis_1_1subscriber_html_a2faf9e9cc9c95e3c0fed148355af84f1"><div class="ttname"><a href="classcpp__redis_1_1subscriber.html#a2faf9e9cc9c95e3c0fed148355af84f1">cpp_redis::subscriber::add_sentinel</a></div><div class="ttdeci">void add_sentinel(const std::string &amp;host, std::size_t port, std::uint32_t timeout_msecs=0)</div></div>
<div class="ttc" id="classcpp__redis_1_1subscriber_html_aad1d0c3c6edb1522eb7b1bdb64b4705d"><div class="ttname"><a href="classcpp__redis_1_1subscriber.html#aad1d0c3c6edb1522eb7b1bdb64b4705d">cpp_redis::subscriber::disconnect</a></div><div class="ttdeci">void disconnect(bool wait_for_removal=false)</div></div>
<div class="ttc" id="classcpp__redis_1_1subscriber_html_a55a8906106adceca1faf6ab26e040f8a"><div class="ttname"><a href="classcpp__redis_1_1subscriber.html#a55a8906106adceca1faf6ab26e040f8a">cpp_redis::subscriber::get_sentinel</a></div><div class="ttdeci">const sentinel &amp; get_sentinel(void) const</div></div>
<div class="ttc" id="classcpp__redis_1_1subscriber_html_a26edc7dcf87ddc8734fac04878ca307a"><div class="ttname"><a href="classcpp__redis_1_1subscriber.html#a26edc7dcf87ddc8734fac04878ca307a">cpp_redis::subscriber::punsubscribe</a></div><div class="ttdeci">subscriber &amp; punsubscribe(const std::string &amp;pattern)</div></div>
<div class="ttc" id="classcpp__redis_1_1subscriber_html_a08dffea41cfd5914adfa5a966e0ab292"><div class="ttname"><a href="classcpp__redis_1_1subscriber.html#a08dffea41cfd5914adfa5a966e0ab292">cpp_redis::subscriber::unsubscribe</a></div><div class="ttdeci">subscriber &amp; unsubscribe(const std::string &amp;channel)</div></div>
<div class="ttc" id="classcpp__redis_1_1subscriber_html_a6ae8134a9a9b31d6f2434ec4f6e86d3a"><div class="ttname"><a href="classcpp__redis_1_1subscriber.html#a6ae8134a9a9b31d6f2434ec4f6e86d3a">cpp_redis::subscriber::connect</a></div><div class="ttdeci">void connect(const std::string &amp;host=&quot;127.0.0.1&quot;, std::size_t port=6379, const connect_callback_t &amp;connect_callback=nullptr, std::uint32_t timeout_msecs=0, std::int32_t max_reconnects=0, std::uint32_t reconnect_interval_msecs=0)</div></div>
<div class="ttc" id="classcpp__redis_1_1subscriber_html_ac6ab8ebc526d784e4b79a39bbd73dca8"><div class="ttname"><a href="classcpp__redis_1_1subscriber.html#ac6ab8ebc526d784e4b79a39bbd73dca8">cpp_redis::subscriber::subscribe_callback_t</a></div><div class="ttdeci">std::function&lt; void(const std::string &amp;, const std::string &amp;)&gt; subscribe_callback_t</div><div class="ttdef"><b>Definition:</b> subscriber.hpp:170</div></div>
<div class="ttc" id="classcpp__redis_1_1subscriber_html_ab7feafca57399394e3a1a0d6daf52770"><div class="ttname"><a href="classcpp__redis_1_1subscriber.html#ab7feafca57399394e3a1a0d6daf52770">cpp_redis::subscriber::subscriber</a></div><div class="ttdeci">subscriber(void)</div><div class="ttdoc">ctor </div></div>
<div class="ttc" id="classcpp__redis_1_1subscriber_html_a13ff83c3944b33851dfcf364f53b146c"><div class="ttname"><a href="classcpp__redis_1_1subscriber.html#a13ff83c3944b33851dfcf364f53b146c">cpp_redis::subscriber::is_connected</a></div><div class="ttdeci">bool is_connected(void) const</div></div>
<div class="ttc" id="classcpp__redis_1_1subscriber_html_afee579c702182041645a3d3c55de4b9e"><div class="ttname"><a href="classcpp__redis_1_1subscriber.html#afee579c702182041645a3d3c55de4b9e">cpp_redis::subscriber::subscribe</a></div><div class="ttdeci">subscriber &amp; subscribe(const std::string &amp;channel, const subscribe_callback_t &amp;callback, const acknowledgement_callback_t &amp;acknowledgement_callback=nullptr)</div></div>
<div class="ttc" id="namespacecpp__redis_html"><div class="ttname"><a href="namespacecpp__redis.html">cpp_redis</a></div><div class="ttdef"><b>Definition:</b> array_builder.hpp:29</div></div>
</div><!-- fragment --></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.13
</small></address>
</body>
</html>
